/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Model;

import java.io.Serializable;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Sik
 */

@Entity
@Table(name = "epingle")
@XmlRootElement
@NamedQueries(
{
    @NamedQuery(name = "Epingle.findAll", query = "SELECT e FROM Epingle e"),
    @NamedQuery(name = "Epingle.findByIdEpingle", query = "SELECT e FROM Epingle e WHERE e.idEpingle = :idEpingle"),
    @NamedQuery(name = "Epingle.findByOrdre", query = "SELECT e FROM Epingle e WHERE e.ordre = :ordre"),
    @NamedQuery(name = "Epingle.findByX", query = "SELECT e FROM Epingle e WHERE e.x = :x"),
    @NamedQuery(name = "Epingle.findByY", query = "SELECT e FROM Epingle e WHERE e.y = :y")
})
public class Epingle implements Serializable
{
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idEpingle")
    private Integer idEpingle;
    @Basic(optional = false)
    @Column(name = "ordre")
    private int ordre;
    @Basic(optional = false)
    @Column(name = "x")
    private int x;
    @Basic(optional = false)
    @Column(name = "y")
    private int y;
    @JoinColumn(name = "Zone_idZone", referencedColumnName = "idZone")
    @ManyToOne(optional = false)
    private Zone zoneidZone;

    public Epingle()
    {
    }

    public Epingle(Integer idEpingle)
    {
        this.idEpingle = idEpingle;
    }

    public Epingle(Integer idEpingle, int ordre, int x, int y)
    {
        this.idEpingle = idEpingle;
        this.ordre = ordre;
        this.x = x;
        this.y = y;
    }

    public Integer getIdEpingle()
    {
        return idEpingle;
    }

    public void setIdEpingle(Integer idEpingle)
    {
        this.idEpingle = idEpingle;
    }

    public int getOrdre()
    {
        return ordre;
    }

    public void setOrdre(int ordre)
    {
        this.ordre = ordre;
    }

    public int getX()
    {
        return x;
    }

    public void setX(int x)
    {
        this.x = x;
    }

    public int getY()
    {
        return y;
    }

    public void setY(int y)
    {
        this.y = y;
    }

    public Zone getZoneidZone()
    {
        return zoneidZone;
    }

    public void setZoneidZone(Zone zoneidZone)
    {
        this.zoneidZone = zoneidZone;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (idEpingle != null ? idEpingle.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Epingle))
        {
            return false;
        }
        Epingle other = (Epingle) object;
        if ((this.idEpingle == null && other.idEpingle != null) || (this.idEpingle != null && !this.idEpingle.equals(other.idEpingle)))
        {
            return false;
        }
        return true;
    }

    public String xmlParse()
    {
        StringBuilder sb = new StringBuilder();
        sb.append("<epingle>");
        sb.append("<ordre>").append(this.getOrdre()).append("</ordre>");
        sb.append("<x>").append(this.getX()).append("</x>");
        sb.append("<y>").append(this.getY()).append("</y>");
        sb.append("</epingle>");
        
        return sb.toString();
    }
    
    @Override
    public String toString()
    {
        return "Model.Epingle[ idEpingle=" + idEpingle + " ]";
    }
}
